package com.example.springboot.entity;

import jakarta.persistence.*;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.*;

@Data
@Entity
@Table(name = "related_story")
@TableName("related_story")
public class RelatedStory {
    @Id
    @TableId(type = IdType.AUTO)
    private Long id;

    @Column(name = "story_id")
    private Long storyId;

    @Column(name = "related_story_id")
    private Long relatedStoryId;

    @Column(name = "sort_order")
    private Integer sortOrder;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "story_id", insertable = false, updatable = false)
    @TableField(exist = false)
    private Story story;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "related_story_id", insertable = false, updatable = false)
    @TableField(exist = false)
    private Story relatedStory;
}